import { handleMsg } from "@/utils";
import { create } from "zustand";
import { subscribeWithSelector } from "zustand/middleware";

export const usePage = /* @__PURE__ */ create(
  /* @__PURE__ */ subscribeWithSelector<PagesState>(() => {
    return {
      loading: true,
      showModal: true,
      content: "弹窗内容！",
      closeModal: 0,
    };
  })
);
export const setPage = usePage.setState;
handleMsg(({ data }) => {
  // console.log("data", data);
  data.content &&
    setPage({
      closeModal: data.content.id,
    });
});
type PagesState = {
  loading: boolean;
  showModal: boolean;
  content: string;
  closeModal: number;
};
